<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script language="JavaScript" src="${ctx}/scripts/sys/calendar.js"></script>
<title><s:text name="joblist"></s:text></title>
<link href="${ctx}/css/main/base.css" rel="stylesheet" type="text/css"/>
<link href="${ctx}/css/main/main.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">
function clear()
{
 document.getElementsById("job.jobName").value="";
 document.getElementsById("job.jobNameEn").value="";
 document.getElementsById("job.jobRate").value="";
 document.getElementsById("job.jobOrder").value="";
}


//在工作角色编号改变时设置工作角色名称

   function setName()
   {
     var select = document.getElementById("job.jobNo");
		 if(select.selectedIndex != 0){
			document.getElementById("job.jobName").value = select[select.selectedIndex].text;
			}else{
				document.getElementById("job.jobNo").value = "";
			}
    }
    
     function checkForm(){
			var jobNo = document.getElementById("job.jobNo");
			var jobRate = document.getElementById("job.jobRate").value;
			 
            if(jobNo.selectedIndex == 0){
				setInfo("jobNoError","请选择工作角色！");
				document.getElementById("job.jobNo").focus();
				return false;
			}
			
			if(jobRate.length == 0||Trim(jobRate)==""){
				setInfo("RateError","请输入小于1的两位小数！");
				return false;
			}
			else{
			if(!(/^[0]+(.[0-9]{1,2})?$/).test(jobRate))
				setInfo("RateError","请输入小于1的两位小数！");
				return false;
			}
	     return true;
	}
	
	function setInfo(field,info){
			document.getElementById(field).style.display = "block";
			document.getElementById(field).innerHTML = "<font color='red'>" + info + "</font>";
		}
</script>
</head>
  <form action="${ctx}/code/code_job_create.action"  method="post" name="form1" onsubmit="return checkForm()">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab_m">
  <tr>
    <td colspan="2" class="zctop left"><span class="font14 zc_bt">工作角色奖金分配新增</span></td>
  </tr>
  <tr>
    <td class="bg5 right">工作角色名称：</td>
    <td><input type="hidden" name="job.jobId" maxlength="100" value="${job.jobId}"/>
    <select name="job.jobNo" class="fl_l"  onchange="setName()">
    <option value="">--请选择工作角色--</option>
    <option value="0" <s:if test="job.jobNo==0">selected</s:if>  >练马师</option>
    <option value="1" <s:if test="job.jobNo==1">selected</s:if> >骑师</option>
    <option value="2" <s:if test="job.jobNo==2">selected</s:if> >马主</option>
    <option value="3" <s:if test="job.jobNo==3">selected</s:if> >马房</option>
    </select><div id="jobNoError" ></div></td>
  </tr>
  <tr>
    <td class="bg5 right">工作角色名称(英)：</td>
    <td><input type="text" name="job.jobNameEn"  maxlength="50" value="${job.jobNameEn}" class="fl_l"/>     <input type="hidden" name="job.jobName"  readonly value="${job.jobNameEn}" /></td>
  </tr>
  <tr>
    <td class="bg5 right">奖金分配比率：</td>
    <td><input type="text" name="job.jobRate"  maxlength="4" value="${job.jobRate}" class="fl_l"/><div id="RateError" ></div></td>
  </tr>
  <tr>
    <td class="bg5 right">排序号：</td>
    <td><input type="text" name="job.jobOrder"  maxlength="50" value="${job.jobOrder}" class="fl_l"/></td>
  </tr>
  <tr>
    <td colspan="2" class="hei_1">
     <input  type="submit" value="提 交" class="log_f zc_b"/>
	<input  type="reset" value="返 回" class="log_f zc_b" onclick="javascript:history.go(-1);"/>
	</td>
  </tr>
</table>
  </form>
</body>
</html>